package cn.fengshenghospital.service.impl;

import cn.fengshenghospital.entity.Experts;
import cn.fengshenghospital.mapper.ExpertsMapper;
import cn.fengshenghospital.service.ExpertsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("expertsService")
public class ExpertsServiceImpl implements ExpertsService {
    @Autowired
    private ExpertsMapper expertsMapper;
    @Override
    public List<Experts> queryExpertsByName(String experName, int page) throws Exception {
        return expertsMapper.queryAllExperts(experName,-1,(page-1)*10,10);
    }

    @Override
    public Experts queryExpertsInfoById(int eId) throws Exception {
        return expertsMapper.queryExpertsInfoById(eId);
    }

    @Override
    public List<Experts> queryExpertsBySid(int sid, int page) throws Exception {
        return expertsMapper.queryAllExperts(null,sid,(page-1)*9,9);
    }

    @Override
    public int queryPage(String sid,String type) throws Exception{
        return expertsMapper.queryPage(sid,type)%9==0?expertsMapper.queryPage(sid,type)/9:expertsMapper.queryPage(sid,type)/9+1;
    }
}
